#include "mynodeinfo.h"

myNodeInfo::myNodeInfo(QWidget *parent)
    : QWidget{parent} {
    QVBoxLayout *layout = new QVBoxLayout(this);
    setLayout(layout);
    m_ID = new QLabel("ID:", this);
    m_name = new QLabel("名称：", this);
    m_address = new QLabel("地址：", this);
    m_rating = new QLabel("评分：", this);
    m_rateNum = new QLabel("评分数：", this);
    layout->addWidget(m_ID);
    layout->addWidget(m_name);
    layout->addWidget(m_address);
    layout->addWidget(m_rating);
    layout->addWidget(m_rateNum);
}

void myNodeInfo::setID(int ID) {
    m_ID->setText(QString("ID:").append(QString::number(ID)));
}

void myNodeInfo::setName(std::string name) {
    m_name->setText(QString("名称：").append(name));
}

void myNodeInfo::setAddress(std::string address) {
    m_address->setText(QString("地址：").append(address));
}

void myNodeInfo::setRating(double rating) {
    m_rating->setText(QString("评分：").append(QString::number(rating)));
}

void myNodeInfo::setRateNum(double rateNum) {
    m_rateNum->setText(QString("评分数：").append(QString::number(rateNum)));
}

